from base import Base
from selenium.webdriver.common.by import By

class page1(Base):
    def shouye(self):
        loc=(By.CLASS_NAME,'android.view.ViewGroup')
        ele=self.find_ele(loc)
        return ele
    # 点击搜索框
    def s1(self):
        loc=(By.XPATH,'//android.widget.TextView[@text="搜索菜谱"]')
        ele=self.find_ele(loc)
        return ele

    # 搜索框输入“清蒸鲈鱼”
    def shuru(self):
        loc=(By.CLASS_NAME,'android.widget.EditText')
        ele=self.find_ele(loc)
        return ele
    # 点击搜索按钮
    def anniu(self):
        loc=(By.XPATH,'//android.widget.TextView[@text="搜索"]')
        ele=self.find_ele(loc)
        return ele

    # 1
    def cai(self):
        loc=(By.ANDROID_UIAUTOMATOR,'new UiSelector().text("10分钟做 清蒸鲈鱼 （附切鱼图解）")')
        ele=self.find_ele(loc)
        return ele
    # 2
    def xinghao(self):
        loc = (By.ANDROID_UIAUTOMATOR, 'new UiSelector().resourceId("com.xiachufang:id/recipe_bto_nav_bar_collect")')
        ele = self.find_ele(loc)
        return ele
    # 3
    def fanhui(self):
        loc=(By.XPATH,'//android.widget.ImageView[@content-desc="返回"]')
        ele=self.find_ele(loc)
        return ele

    def fanhui2(self):
        loc=(By.ID,'com.xiachufang:id/navigation_img_view')
        ele=self.find_ele(loc)
        return ele
    def fanhui3(self):
        loc=(By.XPATH,'//android.widget.ImageView[@content-desc="返回"]')
        ele=self.find_ele(loc)
        return ele

    #4
    def shou(self):
        loc=(By.XPATH,'(//android.widget.LinearLayout[@resource-id="com.xiachufang:id/icon"])[4]/android.widget.ImageView')
        ele=self.find_ele(loc)
        return ele
    # 断言
    def fish(self):
        loc=(By.XPATH,'//android.widget.TextView[@resource-id="com.xiachufang:id/common_first_text"]')
        ele=self.find_ele(loc)
        return ele
